layui.use(['form', 'table', 'layer', 'laydate'], function (form, table, layer, laydate) {
    var app = new Vue({
        el: "#app",
        data: {
            mailList: [],
            show: false
        },
        methods: {
            lookMail: function (mailId) {
                $.ajax({
                    url: "../email/" + mailId,
                    type: 'PUT',
                    success: function (data) {
                        window.location.href = "spam_look.html?id=" + mailId;
                    }
                });
            },
            sendMail() {
                window.location.href = "sendMail.html";
            }
        },
        mounted() {
            const that = this;
            $.ajax({
                url: "../email/book/1/" + parseInt(Base64.decode(getToken())),
                type: 'get',
                success: function (data) {
                    that.mailList = data.obj;
                    if (that.mailList.length === 0) {
                        that.show = true;
                    }
                }
            });
        }
    });
});